package com.itheima.mapper;

import com.itheima.domain.Classes;
import com.itheima.domain.Student;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

public interface StudentMapper {
        @Select("SELECT * FROM student")
        @Results({
                @Result(column ="id",property = "id",id = true),
                @Result(column ="name",property = "name"),
                @Result(column ="age",property = "age"),
                @Result(
                        property = "classes",
                        javaType = Classes.class,
                        column = "cid",
                        one = @One(select = "com.itheima.mapper.ClassesMapper.findByCid",fetchType = FetchType.LAZY)
                )
        })

        List<Student> findAll();
}
